<?php
$request_path = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH);
$clean_route = is_string($request_path) ? trim($request_path, '/') : '';
if ($clean_route !== '' && preg_match('/^[A-Za-z0-9_-]+$/D', $clean_route) === 1) {
    $route_aliases = ['ajouter-livre' => 'admin-ajouter-livre.php'];
    $script_name = $route_aliases[$clean_route] ?? ($clean_route . '.php');
    $route_script = __DIR__ . DIRECTORY_SEPARATOR . $script_name;
    if ($script_name !== 'index.php' && is_file($route_script)) {
        $server_script_name = '/' . $script_name;
        $_SERVER['PHP_SELF'] = $server_script_name;
        $_SERVER['SCRIPT_NAME'] = $server_script_name;
        $_SERVER['SCRIPT_FILENAME'] = $route_script;
        require $route_script;
        exit;
    }
}

require_once __DIR__ . '/config.php';
$title = "Le réseau, levier de la réussite";
require_once __DIR__ . '/includes/header.php';

// Récupération des 3 articles publiés les plus récents
$articles_recents = [];
if (isset($pdo)) {
    try {
        $stmt_recent = $pdo->query("SELECT b.id, b.titre, b.categorie, b.chapeau, b.contenu, b.image_couverture, b.date_publication, b.date_creation, m.nom, m.prenom
            FROM blog_articles b
            LEFT JOIN membres m ON b.cree_par = m.id
            WHERE LOWER(TRIM(COALESCE(b.statut, ''))) = 'publié'
            ORDER BY COALESCE(b.date_publication, b.date_creation) DESC
            LIMIT 3");
        if ($stmt_recent) {
            $articles_recents = $stmt_recent->fetchAll(PDO::FETCH_ASSOC);
        }
    } catch (PDOException $e) {
        $articles_recents = [];
    }
}

// 1. Initialisation de sécurité pour éviter les erreurs PHP si la BDD est incomplète
$real_membres_actifs = $real_partenaires = $real_certifies = $real_jeunes_accompagnes = $real_livres = 0;
$real_projets_finances = $real_projets_en_cours = $real_entreprises_creees = 0;

// La base de données reste la source de vérité pour afficher les partenaires récemment ajoutés.
$partners = [];
$partners_cache_file = __DIR__ . '/cache/partners_cache.json';

if (isset($pdo)) {
    try {
        $partners = $pdo->query("SELECT * FROM cdea_partners ORDER BY ordre ASC, nom_partenaire ASC")->fetchAll(PDO::FETCH_ASSOC);
        file_put_contents($partners_cache_file, json_encode($partners));
    } catch (PDOException $e) {
        error_log("Erreur de chargement des partenaires : " . $e->getMessage());
        if (file_exists($partners_cache_file)) {
            $cached_partners = json_decode(file_get_contents($partners_cache_file), true);
            $partners = is_array($cached_partners) ? $cached_partners : [];
        }
    }
} elseif (file_exists($partners_cache_file)) {
    $cached_partners = json_decode(file_get_contents($partners_cache_file), true);
    $partners = is_array($cached_partners) ? $cached_partners : [];
}

// --- RÉCUPÉRATION FIABILISÉE DES STATISTIQUES ---
// Valeurs par défaut à 0 (données réelles)
$real_membres_actifs = 50;
$real_partenaires = 2;
$real_certifies = 0;
$real_jeunes_accompagnes = 1;
$real_livres = 600;
$real_entreprises_creees = 0;
$real_projets_finances = 0;
$real_projets_en_cours = 4;

if (isset($pdo)) {
    // Exécute chaque requête individuellement pour qu'une erreur sur une table n'affecte pas les autres
    try { 
        $real_membres_actifs = (int)$pdo->query("SELECT COUNT(id) FROM membres")->fetchColumn();
    } catch (PDOException $e) {}
    
    try { 
        $real_partenaires = (int)$pdo->query("SELECT COUNT(id) FROM cdea_partners")->fetchColumn();
    } catch (PDOException $e) {}
    
    try { 
        $real_certifies = (int)$pdo->query("SELECT COUNT(id) FROM inscriptions_formations WHERE statut_inscription = 'valide'")->fetchColumn();
    } catch (PDOException $e) {}
    
    try { 
        $real_jeunes_accompagnes = (int)$pdo->query("SELECT COUNT(DISTINCT email) FROM reservations_coaching WHERE statut != 'annule'")->fetchColumn();
    } catch (PDOException $e) {}
    
    try { 
        $real_livres = (int)$pdo->query("SELECT COUNT(id) FROM livres")->fetchColumn();
    } catch (PDOException $e) {}
    
    try { 
        $real_entreprises_creees = (int)$pdo->query("SELECT COUNT(DISTINCT nom_organisme) FROM membres WHERE nom_organisme IS NOT NULL AND nom_organisme != ''")->fetchColumn();
    } catch (PDOException $e) {}
    
    try { 
        $real_projets_finances = (int)$pdo->query("SELECT COUNT(id) FROM projets WHERE statut = 'Finance'")->fetchColumn();
    } catch (PDOException $e) {}
    
    try { 
        $real_projets_en_cours = (int)$pdo->query("SELECT COUNT(id) FROM projets WHERE statut = 'En cours'")->fetchColumn();
    } catch (PDOException $e) {}
}
// --- AJOUTEZ CECI DANS VOTRE BLOC PHP PRINCIPAL EN HAUT DE PAGE ---
$month_map = [
    'January' => 'Janvier', 'February' => 'Février', 'March' => 'Mars', 
    'April' => 'Avril', 'May' => 'Mai', 'June' => 'Juin', 
    'July' => 'Juillet', 'August' => 'Août', 'September' => 'Septembre', 
    'October' => 'Octobre', 'November' => 'Novembre', 'December' => 'Décembre'
];
$date_maj = str_replace(array_keys($month_map), array_values($month_map), date('d F Y'));
?>

<!-- Bibliothèques d'animations -->
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"/>
<!-- NOUVEAU : Swiper.js pour le carrousel des actualités -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css" />
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>



<meta name="viewport" content="width=device-width, initial-scale=1.0">

<style>
    /* Styles spécifiques à la page d'accueil non inclus dans le header global */
    .hero-section { background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('assets/img/cdea.jpg'); background-size: cover; color: white; padding: 100px 0; }
    .text-muted1 { color: #f9dac8; font-size: 0.725rem; }
    .card:hover { background-color: #ededef; }
    .card-hover { transition: transform 0.3s ease, box-shadow 0.3s ease; }
    .card-hover:hover { transform: translateY(-10px); box-shadow: 0 1rem 3rem rgba(0,0,0,.175) !important; }
    .partner-logo { 
        max-height: 90px; 
        max-width: 220px; 
        object-fit: contain; 
        filter: none; 
        opacity: 1; 
        transition: transform 0.3s ease; 
        cursor: pointer; 
        width: auto; 
        height: auto; 
    }
    .partner-logo:hover { 
        transform: scale(1.08); 
    }
    /* Styles pour le carrousel à défilement infini */
    .logo-carousel-container {
        overflow: hidden;
        position: relative;
        width: 100%;
        padding: 20px 0;
        mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
        -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    }

    .logo-carousel-track {
        display: flex;
        width: max-content;
        align-items: center;
        animation: scroll-left 25s linear infinite; /* Vitesse fluide et lisible */
    }

    .logo-carousel-track:hover {
        animation-play-state: paused; /* Met en pause au survol */
    }

    .logo-carousel-item {
        flex: 0 0 250px; /* Espace adapté pour les logos agrandis */
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px 20px;
    }

    .btn-hover {
    transition: all 0.3s ease-in-out; /* Assure la fluidité du mouvement */
}

.btn-hover:hover {
    transform: translateY(-5px); /* Le bouton monte légèrement */
    box-shadow: 0 10px 20px rgba(0,0,0,0.2) !important; /* L'ombre s'intensifie */
    filter: brightness(1.1); /* Le bouton devient un peu plus lumineux */
}

/* Optionnel : Effet "Pulse" (si vous voulez attirer l'attention en permanence) */
@keyframes pulse-animation {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.btn-pulse {
    animation: pulse-animation 2s infinite;
}

 /* Texture subtile pour le background de la section */
    .bg-avantages {
        background-color: #f8f9fa; /* bg-light de Bootstrap */
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3E%3Cpath fill='%230d6efd' fill-opacity='0.05' d='M1 3h1v1H1V3zm2-2h1v1H2V1z'%3E%3C/path%3E%3C/svg%3E");
    }

    /* Mouvement et relief des cartes au survol */
    .card-hover-effect {
        transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out;
    }

    .card-hover-effect:hover {
        transform: translateY(-8px); /* La carte se soulève */
        box-shadow: 0 1rem 3rem rgba(13, 110, 253, 0.15) !important; /* L'ombre devient un bleu CDEA très léger */
        border-color: rgba(13, 110, 253, 0.5) !important; /* La bordure s'intensifie légèrement */
    }

    /* Animation Pulse pour le bouton CTA */
    @keyframes pulse-cdea {
        0% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.4); }
        70% { box-shadow: 0 0 0 10px rgba(13, 110, 253, 0); }
        100% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0); }
    }

    .btn-pulse {
        animation: pulse-cdea 2s infinite;
    }

    @keyframes scroll-left {
        0% { transform: translateX(0); }
        100% { transform: translateX(-50%); } /* Défile exactement la moitié pour une boucle continue invisible */
    }

    /* Ajustements responsifs pour la largeur des éléments du carrousel */
    @media (max-width: 767.98px) {
        .logo-carousel-item {
            flex: 0 0 180px;
            padding: 8px 12px;
        }
        .partner-logo {
            max-height: 65px;
            max-width: 155px;
        }
    }


    /* Animation de flottement pour l'image */
    @keyframes float {
        0% { transform: translateY(0px); }
        50% { transform: translateY(-15px); }
        100% { transform: translateY(0px); }
    }
    .floating-img {
        animation: float 4s ease-in-out infinite;
    }
    /* NOUVEAU : Styles pour la section Actualités */
    .news-card {
        display: flex;
        flex-direction: column;
        height: 100%;
        border-radius: 16px;
        overflow: hidden;
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }
    .news-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 1rem 3rem rgba(0,74,153,0.1) !important;
    }
    .news-card .card-img-top {
        height: 200px;
        object-fit: cover;
    }
    
    /* Background dynamique pour la section */
    .bg-soumission {
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    }
</style>



    <!-- Section Héro -->
    <header class="hero-section text-center">
        <div class="container">
            <h1 class="display-3 fw-bold animate__animated animate__fadeInDown"><?php echo htmlspecialchars($config['site_tagline'] ?? 'Le réseau, levier de la réussite'); ?></h1>
            <p class="lead mb-4 animate__animated animate__fadeInUp animate__delay-1s">Accompagner l'élite africaine de demain...</p>
            <div class="d-grid gap-2 d-md-block">
                <a href="guide_adhesion.php" class="btn btn-primary btn-lg px-4 me-md-2 btn-hover">Devenir Membre</a>
                <a href="nos-activites.php" class="btn btn-warning btn-lg px-4 me-md-2 btn-hover">Nos Services</a>
                <a href="apropos.php" class="btn btn-outline-light btn-lg px-4 btn-hover">En savoir plus</a>
            </div>
        </div>
    </header>

     <!-- Section propos--> 

    <section id="propos" class="py-5" data-aos="fade-up">
    <div class="container">
        <div class="row align-items-center g-5">
            <div class="col-md-6">
                <h2 class="fw-bold text-cdea mb-4">Qui sommes-nous ?</h2>
                <p class="lead text-muted">Le <strong>Cercle des Entrepreneurs Africains (CDEA)</strong> est une ASBL basée à Lubumbashi, dédiée à la création de ponts entre les porteurs de projets et les investisseurs.</p>
                <p>Notre mission est de rendre vos visions <strong>« bancables »</strong> et de favoriser l'émergence d'une économie forte, portée par l'intégrité, l'éthique et l'innovation collaborative.</p>
            </div>
            
            <div class="col-md-6 text-center">
                <img src="assets/img/carte.jpg" alt="Carte de l'Afrique CDEA" class="img-fluid rounded shadow-sm" style="max-height: 300px;">
            </div>
        </div>

        <div class="text-center mt-5">
            <a href="nos-activites.php" class="btn btn-outline-primary rounded-pill px-5 py-3 fw-bold shadow-sm">
                Découvrir le détail de nos pôles d'activités
            </a>
        </div>
    </div>
</section>

<!-- Section Actualités -->

<section id="actualites" class="py-5 bg-white" data-aos="fade-up">
    <div class="container">
        <div class="d-flex flex-column flex-md-row justify-content-between align-items-md-end mb-5 text-center text-md-start">
            <div>
                <h2 class="fw-bold text-cdea">Actualités & Événements</h2>
                <p class="text-muted mb-0">Suivez les moments forts de notre réseau et l'évolution de l'entrepreneuriat en Afrique.</p>
            </div>
            <a href="blog.php" class="btn btn-outline-primary rounded-pill px-4 mt-3 mt-md-0 flex-shrink-0">
                Voir tout l'historique
            </a>
        </div>

        <!-- Carrousel Swiper - AMÉLIORÉ -->
        <div class="swiper" id="news-swiper">
            <div class="swiper-wrapper pb-5">
                <?php if (empty($articles_recents)): ?>
                    <div class="swiper-slide h-auto">
                        <div class="alert alert-light text-center">Aucune actualité pour le moment.</div>
                    </div>
                <?php else: foreach ($articles_recents as $art): ?>
                    <div class="swiper-slide h-auto">
                        <div class="card news-card border-0 shadow-sm">
                            <div class="position-relative">
                                <?php 
                                $badge_color = 'bg-primary';
                                if($art['categorie'] === 'Opportunités') $badge_color = 'bg-warning text-dark';
                                if($art['categorie'] === 'Communiqué Officiel') $badge_color = 'bg-danger';
                                if($art['categorie'] === 'Éducation Financière') $badge_color = 'bg-success';
                                ?>
                                <span class="badge <?php echo $badge_color; ?> position-absolute top-0 start-0 m-3" style="z-index: 2;"><?php echo htmlspecialchars($art['categorie']); ?></span>
                                <img src="<?php echo !empty($art['image_couverture']) ? htmlspecialchars($art['image_couverture']) : 'assets/img/default-blog.jpg'; ?>" class="card-img-top" alt="<?php echo htmlspecialchars($art['titre']); ?>">
                            </div>
                            <div class="card-body d-flex flex-column p-4">
                                <p class="small text-muted mb-2"><i class="bi bi-calendar3 me-1"></i> <?php echo date('d/m/Y', strtotime($art['date_publication'])); ?></p>
                                <h5 class="card-title fw-bold flex-grow-1" style="font-size: 1.1rem; line-height: 1.4;"><?php echo htmlspecialchars($art['titre']); ?></h5>
                                <a href="article?id=<?php echo $art['id']; ?>" class="btn btn-sm btn-primary rounded-pill align-self-start mt-3">
                                    Lire la suite <i class="bi bi-arrow-right"></i>
                                </a>
                            </div>
                        </div>
                    </div>
                <?php endforeach; endif; ?>
            </div>
            <!-- Pagination du carrousel -->
            <div class="swiper-pagination mt-4 position-relative"></div>
        </div>
    </div>
</section>

 <!-- Section piliers--> 

 <!-- Section impact-->
<section id="impact" class="py-5 bg-cdea text-white" data-aos="fade-up">
    <div class="container">
        <div class="text-center mb-5">
            <h2 class="fw-bold">Le CDEA en chiffres</h2>
            <p class="opacity-75">Un impact concret au cœur de notre écosystème</p>
        </div>

        <div class="row text-center g-3 g-md-4">
            <?php 
            $stats = [
                ['key' => 'membres_actifs', 'val' => $real_membres_actifs, 'label' => 'Membres Actifs', 'desc' => 'Entrepreneurs & Investisseurs'],
                ['key' => 'projets_finances', 'val' => $real_projets_finances, 'label' => 'Projets Financés', 'desc' => 'Par le CDEA et ses Partenaires'],
                ['key' => 'jeunes_certifies', 'val' => $real_certifies, 'label' => 'Jeunes Certifiés', 'desc' => 'Formation professionnelle'],
                ['key' => 'partenaires', 'val' => $real_partenaires, 'label' => 'Partenaires', 'desc' => 'Institutions & Entreprises']
            ];
            foreach ($stats as $stat): ?>
                <div class="col-6 col-md-3"> 
                    <div class="p-3 border border-light border-opacity-25 rounded shadow-sm h-100">
                        <!-- On affiche directement la valeur PHP -->
                        <div class="display-6 fw-bold mb-1 countup" 
                             data-stat="<?php echo $stat['key']; ?>" 
                             data-target="<?php echo $stat['val']; ?>">
                            <?php echo number_format($stat['val'], 0, ',', ' '); ?>
                        </div>
                        <h6 class="text-uppercase fw-semibold mb-1"><?php echo $stat['label']; ?></h6>
                        <small class="opacity-75 d-block"><?php echo $stat['desc']; ?></small>
                    </div>
                </div>
            <?php endforeach; ?>
        </div>
    </div>
</section>


 <!-- Section Expansion--> 
 

    <section id="expansion" class="py-5 bg-dark text-white" data-aos="fade-up">
    <div class="container">
        <div class="row align-items-center g-5">
            <div class="col-lg-6">
                <h2 class="fw-bold mb-4">Un Réseau Sans Frontières</h2>
                <p class="lead text-white-50">Le CDEA ne s'arrête pas aux frontières de la RDC. Notre vision est d'élargir ce levier de réussite à toute l'Afrique.</p>
                <p>Nous croyons que l'intelligence financière et l'entrepreneuriat éthique sont les clés du développement du continent. C'est pourquoi notre plateforme est conçue pour inclure tout le monde, peu importe votre situation géographique.</p>
                
                <div class="mt-4">
                    <div class="d-flex align-items-start mb-3">
                        <div class="text-primary me-3"><i class="bi bi-check-circle-fill fs-4"></i></div>
                        <span><strong>Accessibilité Universelle :</strong> Que vous soyez porteur de projet ou investisseur, vous avez votre place.</span>
                    </div>
                    <div class="d-flex align-items-start mb-3">
                        <div class="text-primary me-3"><i class="bi bi-check-circle-fill fs-4"></i></div>
                        <span><strong>Force de la Diaspora :</strong> Un pont entre les talents africains locaux et ceux de l'étranger.</span>
                    </div>
                    <div class="d-flex align-items-start">
                        <div class="text-primary me-3"><i class="bi bi-check-circle-fill fs-4"></i></div>
                        <span><strong>Croissance Collective :</strong> Un réseau qui grandit pour devenir le point de référence de l'élite africaine.</span>
                    </div>
                </div>
            </div>
            <div class="col-lg-6">
                <div class="p-4 bg-light text-dark rounded-4 shadow-lg border border-primary border-opacity-50 text-center">
                    <div class="mb-3">
                        <i class="bi bi-globe-europe-africa text-primary" style="font-size: 5rem;"></i>
                    </div>
                    <h4 class="fw-bold">Objectif : 54 Pays</h4>
                    <p class="small text-muted">Nous bâtissons aujourd'hui les fondations d'un empire économique africain basé sur la solidarité et l'excellence.</p>
                    <hr class="my-4">
                    <div class="row text-center">
                        <div class="col-4">
                            <h5 class="fw-bold mb-0">RDC</h5>
                            <small class="text-muted">Siège</small>
                        </div>
                        <div class="col-4 border-start border-end">
                            <h5 class="fw-bold mb-0">Afrique</h5>
                            <small class="text-muted">Expansion</small>
                        </div>
                        <div class="col-4">
                            <h5 class="fw-bold mb-0">Monde</h5>
                            <small class="text-muted">Diaspora</small>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

     <!-- Section activites-stats--> 

   <section id="activites-stats" class="py-5 bg-white" data-aos="fade-up">
    <div class="container">
        <div class="text-center mb-5">
            <h2 class="fw-bold text-cdea">Bilan de nos Activités</h2>
            <p class="text-muted">Des indicateurs mis à jour en temps réel selon l'évolution de nos projets sur le terrain.</p>
        </div>

        <div class="row g-4">
            <div class="col-6 col-md-3">
                <div class="text-center p-4 border-bottom border-primary border-4 bg-white shadow-sm rounded-3 h-100 card-hover">
                    <div class="fs-1 fw-bold text-primary mb-1 countup" data-stat="jeunes_accompagnes" data-target="<?php echo $real_jeunes_accompagnes; ?>">0</div>
                    <p class="small text-uppercase fw-bold mb-1">Jeunes accompagnés</p>
                    <small class="text-muted">Coaching & mentorat</small>
                </div>
            </div>

            <div class="col-6 col-md-3">
                <div class="text-center p-4 border-bottom border-success border-4 bg-white shadow-sm rounded-3 h-100 card-hover">
                    <div class="fs-1 fw-bold text-success mb-1 countup" data-stat="entreprises_creees" data-target="<?php echo $real_entreprises_creees; ?>">0</div>
                    <p class="small text-uppercase fw-bold mb-1">Entreprises Créées</p>
                    <small class="text-muted">Par les membres</small>
                </div>
            </div>

            <div class="col-6 col-md-3">
                <div class="text-center p-4 border-bottom border-warning border-4 bg-white shadow-sm rounded-3 h-100 card-hover">
                    <div class="fs-1 fw-bold text-warning mb-1 countup" data-stat="projets_en_cours" data-target="<?php echo $real_projets_en_cours; ?>">0</div>
                    <p class="small text-uppercase fw-bold mb-1">Projets en Cours</p>
                    <small class="text-muted">En développement</small>
                </div>
            </div>

            <div class="col-6 col-md-3">
                <div class="text-center p-4 border-bottom border-info border-4 bg-white shadow-sm rounded-3 h-100 card-hover">
                    <div class="fs-1 fw-bold text-info mb-1 countup" data-stat="livres" data-target="<?php echo $real_livres; ?>">0</div>
                    <p class="small text-uppercase fw-bold mb-1">Livres Disponibles</p>
                    <small class="text-muted">Bibliothèque numérique</small>
                </div>
            </div>
        </div>

        <div class="mt-5 text-center">
            <p class="fst-italic text-muted small">
                <i class="bi bi-arrow-clockwise"></i> Dernière mise à jour : <?php echo $date_maj; ?>
            </p>
        </div>
    </div>
</section>

 <!-- Section Avantages--> 

<!-- Soumission projet--> 


<section id="soumission-projet" class="py-5 bg-soumission" data-aos="fade-up">
    <div class="container">
        <div class="row align-items-center g-5">
            
            <div class="col-lg-5 text-center"> 
                <div class="p-4 bg-white rounded-4 shadow-sm border border-light floating-img">
                    <img src="assets/img/forma2.jpg" alt="Appel à projets CDEA" class="img-fluid rounded-3" style="max-width: 100%; height: auto;">
                </div>
            </div>

            <div class="col-lg-7">
                <h2 class="display-5 fw-bold text-cdea mb-4">Vous avez un projet ambitieux ?</h2>
                <p class="lead text-muted mb-4">Ne laissez pas vos idées dormir. Le CDEA est la plateforme qui transforme votre vision en une réalité « bancable » et finançable.</p>
                
                <div class="row g-4 py-3">
                    <div class="col-sm-6">
                        <div class="d-flex align-items-start">
                            <i class="bi bi-search fs-3 me-3 text-primary"></i>
                            <div>
                                <h6 class="fw-bold mb-1">Analyse Gratuite</h6>
                                <p class="small text-muted">Un premier diagnostic de viabilité par nos experts.</p>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="d-flex align-items-start">
                            <i class="bi bi-people-fill fs-3 me-3 text-primary"></i>
                            <div>
                                <h6 class="fw-bold mb-1">Accès Investisseurs</h6>
                                <p class="small text-muted">Présentez votre projet à notre réseau de Business Angels.</p>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="mt-4">
                    <a href="soumettre-un-projet.php" class="btn btn-primary btn-lg px-5 py-3 rounded-pill shadow-lg btn-hover">
                        Soumettre mon projet maintenant
                    </a>
                </div>
                <p class="mt-3 small text-muted fst-italic">
                    <i class="bi bi-info-circle me-1"></i> * Diagnostic gratuit pour les membres et payant pour les non-membres.
                </p>
            </div>
            
        </div>
    </div>
</section>

    

    <!-- Section Formations -->

   <section id="formations" class="py-5 bg-light" data-aos="fade-up">
    <div class="container">
        <div class="row align-items-center g-5">
            <div class="col-lg-6">
                <h2 class="fw-bold text-cdea mb-4">L'Académie de l'Excellence CDEA</h2>
                <p class="lead">Plus qu'une simple transmission de savoir, nous forgeons les leaders économiques de l'Afrique de demain.</p>
                <p class="text-muted">Nos programmes de formation intensive sont conçus pour répondre aux réalités du terrain et aux exigences de rentabilité des investisseurs. Nous intervenons sur trois axes stratégiques :</p>
                
                <ul class="list-unstyled mt-4">
                    <li class="mb-4 d-flex align-items-start">
                        <i class="bi bi-check2-circle text-primary fs-4 me-3 mt-1"></i>
                        <div><strong>Intelligence Financière :</strong> Maîtrise de la gestion de trésorerie, fiscalité des PME et éducation aux mécanismes d'investissement.</div>
                    </li>
                    <li class="mb-4 d-flex align-items-start">
                        <i class="bi bi-check2-circle text-primary fs-4 me-3 mt-1"></i>
                        <div><strong>Ingénierie de Projet :</strong> De l'idée brute à l'élaboration de business plans "bancables" prêts pour le financement.</div>
                    </li>
                    <li class="mb-4 d-flex align-items-start">
                        <i class="bi bi-check2-circle text-primary fs-4 me-3 mt-1"></i>
                        <div><strong>Leadership & Gouvernance :</strong> Développement des compétences managériales basées sur l'éthique et l'excellence opérationnelle.</div>
                    </li>
                </ul>
                
                <div class="mt-4">
                    <a href="formations.php" class="btn btn-primary btn-lg rounded-pill px-5 shadow-sm btn-hover">
                        <i class="bi bi-mortarboard me-2"></i> Consulter le catalogue complet
                    </a>
                </div>
            </div>

            <div class="col-lg-6">
                <div class="card border-0 shadow-lg rounded-4 overflow-hidden">
                    <img src="assets/img/forma1.jpg" class="img-fluid" alt="Académie CDEA">
                    <div class="card-body bg-dark text-white p-4">
                        <div class="d-flex align-items-center justify-content-center text-center">
                            <div class="px-3">
                                <div class="display-4 fw-bold text-warning mb-0 countup" data-stat="certifications_per_an" data-target="500">0</div>
                                <small class="text-uppercase fw-bold opacity-75">Certifications / An</small>
                            </div>
                            <div class="vr mx-3" style="height: 50px; opacity: 0.2;"></div>
                            <div class="px-3">
                                <i class="bi bi-patch-check-fill text-success display-5"></i>
                                <p class="small mb-0 mt-2">Reconnu par le Réseau</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

    <!-- Section Bénévoles -->

   <section id="benevoles" class="py-5 bg-dark text-white" data-aos="fade-up">
    <div class="container text-center">
        <h2 class="fw-bold mb-3 text-white">Devenez un Contributeur CDEA</h2>
        <p class="lead mb-4 text-white-50 mx-auto" style="max-width: 800px;">
            Vous êtes un expert, un formateur, un mentor ou simplement passionné par l'entrepreneuriat africain ? 
            Rejoignez notre équipe de bénévoles et partagez votre savoir pour bâtir l'élite de demain.
        </p>
        <a href="devenir-benevole.php" class="btn btn-primary btn-lg px-5 py-3 rounded-pill shadow-lg btn-hover">
            <i class="bi bi-people-fill me-2"></i> Proposer ma contribution
        </a>
    </div>
</section>

    <!-- Section Faire un don -->

    <section id="faire-un-don" class="py-5 bg-primary text-white text-center" data-aos="fade-up" style="background: linear-gradient(rgba(2, 49, 119, 0.95), rgba(3, 50, 119, 0.95));">
    <div class="container">
        <h2 class="fw-bold mb-3 display-6">Soutenez nos Actions !</h2>
        <p class="lead mb-4 opacity-90 mx-auto" style="max-width: 700px;">
            Votre générosité est le moteur de nos initiatives pour l'entrepreneuriat africain. 
            Chaque don contribue directement à la formation, au mentorat et au financement de projets à fort impact.
        </p>
        <a href="faire-un-don.php" class="btn btn-warning btn-lg px-5 py-3 rounded-pill shadow-lg fw-bold text-dark btn-hover">
            <i class="bi bi-heart-fill me-2"></i> Faire un don maintenant
        </a>
        <p class="small mt-4 opacity-75">
            <i class="bi bi-shield-check me-2"></i> Transparence garantie : Un reçu vous sera envoyé pour toute contribution.
        </p>
    </div>
</section>

<!-- Section Nos Partenaires -->

    <section id="partenaires" class="py-5 bg-light" data-aos="fade-up">
        <div class="container">
            <div class="text-center mb-5">
                <h2 class="fw-bold text-cdea">Nos Partenaires Stratégiques</h2>
                <p class="text-muted">Ils soutiennent l'émergence de l'élite économique africaine.</p>
                <div class="mx-auto" style="width: 80px; height: 5px; background: var(--cdea-gold); margin-top: 15px;"></div>
            </div>

            <?php if (!empty($partners)): ?>
                <div class="logo-carousel-container">
                    <div class="logo-carousel-track">
                        <?php 
                        // Assurer un défilement infini fluide même avec 1 seul logo ou très peu
                        $count_partners = count($partners);
                        $target_half = 8; // Garantit au moins 8 logos dans chaque moitié pour combler l'écran
                        $repeat_count = ($count_partners > 0) ? (int) max(1, ceil($target_half / $count_partners)) : 1;
                        $half_list = [];
                        for ($i = 0; $i < $repeat_count; $i++) {
                            $half_list = array_merge($half_list, $partners);
                        }
                        // La piste totale contient exactement 2 moitiés identiques pour boucler parfaitement à -50%
                        $display_partners = array_merge($half_list, $half_list);
                        foreach ($display_partners as $p): 
                        ?>
                            <div class="logo-carousel-item">
                                <a href="<?php echo htmlspecialchars($p['lien_site'] ?? '#'); ?>" target="_blank" rel="noopener noreferrer" title="<?php echo htmlspecialchars($p['nom_partenaire']); ?>">
                                    <img src="<?php echo htmlspecialchars($p['logo_url']); ?>" class="img-fluid partner-logo" alt="<?php echo htmlspecialchars($p['nom_partenaire']); ?>" onerror="this.src='https://placehold.co/200x80?text=LOGO'">
                                </a>
                            </div>
                        <?php endforeach; ?>
                    </div>
                </div>
            <?php else: ?>
                <div class="text-center text-muted small">Aucun partenaire à afficher pour le moment.</div>
            <?php endif; ?>
        </div>
    </section>

    <!-- Section Implantation -->

<script>
document.addEventListener('DOMContentLoaded', function () {
    new Swiper('#news-swiper', {
        loop: true, // Réactivé pour un défilement continu
        slidesPerView: 1,
        spaceBetween: 24,
        autoplay: {
            delay: 6000, // 4 secondes entre chaque slide
            disableOnInteraction: false, // L'autoplay reprend même après une interaction manuelle
            pauseOnMouseEnter: true, // Met en pause au survol de la souris
        },
        pagination: {
            el: '.swiper-pagination',
            clickable: true, // Permet de cliquer sur les points de pagination
        },
        breakpoints: {
            768: {
                slidesPerView: 2,
            },
            992: {
                slidesPerView: 3,
            }
        }
    });
});
</script>

    <?php require_once __DIR__ . '/includes/footer.php'; ?>
